import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import "./registerServiceWorker";
import { Toast, Loading, Lazyload } from "vant";
import axios from 'axios'
import VueAxios from 'vue-axios'

Vue.use(Toast);
Vue.use(Loading);
// Vue.use(Lazyload);
Vue.config.productionTip = false;
Vue.prototype.globalShowLoading = true
Vue.prototype.$http = axios
Vue.use(VueAxios,axios)

router.beforeEach((to, from, next) => {
  console.log("router--")

  setTimeout(()=>{

     var _hmt = _hmt || [];

     (function() {

      //每次执行前，先移除上次插入的代码

      document.getElementById('baidu_tj') && document.getElementById('baidu_tj').remove();   //判断有没有 baidu_tj  元素，有就删除

      var hm = document.createElement("script");

      hm.src = "https://hm.baidu.com/hm.js?ebd1de27858d5577a94dc07698b89efa";

      hm.id = "baidu_tj"

      var s = document.getElementsByTagName("script")[0];

      s.parentNode.insertBefore(hm, s);

     })();

  },0);

  next();

})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
